<?php
	require_once(dirname(dirname(__DIR__)) . '/core.php');

	if($_SESSION['is_login']){
		$cart = Model('cart')->listCart('db',array('buyer_id'=>$_SESSION['member_id']));
	}
	else{
		$cart = Model('cart')->listCart('cookie',array('buyer_id'=>$_SESSION['member_id']));
	}
	$cart = logic('buy_1')->getGoodsCartList($cart);
?>
    <i class="cart-icons"></i>
    <?php
    	if(count($cart)){
    ?>
    <div class="cart_content_all _cart_content" style="display: none;">
        <div class="cart_content_center">
        	<?php 
        		$count = 0;
        		$total = 0;
        		foreach($cart as $key => $val){
        			$count += $val['goods_num'];
					$total += $val['goods_price'] * $val['goods_num'];
        	?>
			<div class="cart_con_over cart_con_single">
				<div class="single_pic">
					<a href="/shop/index.php?act=goods&goods_id=<?php echo $val['goods_id']?>" target="_blank" alt="">
						<img src="/data/upload/shop/store/goods/<?php echo $val['store_id']?>/<?php echo $val['goods_image']?>">
					</a>
				</div>
			<div class="single_info"><a href="/shop/index.php?act=goods&goods_id=<?php echo $val['goods_id']?>" target="_blank" alt="" class="name"><?php echo $val['goods_name']?></a><span class="price">￥<?php echo $val['goods_price']?></span><span class="price_plus"> x </span><span class="price_num"><?php echo $val['goods_num']?></span>
				</div>
			</div>
			<?php }?>
		</div>
		<div class="con_all">
			<div class="price_whole"><span>共<span class="num_all"><?php echo $count;?></span>件商品</span>
			</div>
			<div><span class="price_gongji">共计<em>￥</em><span class="total_price"><?php echo $total;?></span></span><a href="/shop/index.php?act=cart" class="cart_btn" rel="nofollow">去购物车结算</a>
			</div>
		</div>
    </div>
    <?php		
    	}else{

 	?>
    <div class="cart_content_null _cart_content" style="display: none;">购物车中还没有商品，<br>快去挑选心爱的商品吧！</div>
 	<?php   		
    	}
    ?>
            
